package com.pengweiwei.androidzygote.goods;

import android.os.Bundle;

import com.android.volley.Request;
import com.putong35.common.app.ui.AppListFragment;
import com.putong35.common.baseactfrag.adapter.DataBindRecyclerViewAdapter;
import com.putong35.common.baseactfrag.adapter.RecyclerViewBaseAdapter;
import com.putong35.common.httprequest.responsecallbacks.ListBeanResponseListener;
import com.putong35.common.httprequest.responsecallbacks.ListBeanResponseListenerImpl;
import com.pengweiwei.androidzygote.BR;
import com.pengweiwei.androidzygote.R;
import com.pengweiwei.androidzygote.main.UrlCenter;


/**
 * 刷列表的模板
 * <p>
 * 主要分为三步：fragment  + adapter(+ layout布局)  + bean
 * <p>
 * 2. adapter要设置 泛型参数（LoginResponce）  e.g extends RecyclerViewBaseAdapter<LoginResponce>
 */
public class GoodsListFragment extends AppListFragment {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestInfo(Request.Method.GET, UrlCenter.GOODS_LIST);
    }


    @Override
    public RecyclerViewBaseAdapter createAdapter() {
        return new DataBindRecyclerViewAdapter<GoodsBean>(getActivity(), R.layout.listitem_goods, BR.itemBean);
    }


    @Override
    public ListBeanResponseListener makeResponseListener() {
        return new ListBeanResponseListenerImpl<>(GoodsBean.class, this);
    }

}
